var URL = require('url');
var User = require('./user');
var express = require('express');
var router = express.Router();

router.get('/',function(req,res,next){
	res.send("respond with a resource");
});

router.get('/getUserInfo', function(req, res, next) {
	var user = new User();
	var params = URL.parse(req.url, true).query;
	
	if(params.id == '1') {
		user.name = "light";
		user.age = "10";
		user.city = "北京市";
	}else{ 
		user.name = "bean";
		user.age = "20";
		user.city = "广州市";
	}
	
	var response = {status:1,data:user};
	res.send(JSON.stringify(response));

});

module.exports = router;
